find character from string c# count

42

c# count number of occurrences in string -

char myChar = 'x';
string myString = "xyz";

int count = myString.Count(s => s == myChar);

find character from string c# count -

int count = Regex.Matches(test, "word").Count;

Comments

Submit
0 Comments